package com.doget.data.dialog;


import android.app.Dialog;
import android.content.Context;
import android.graphics.Color;
import android.graphics.drawable.ColorDrawable;
import android.os.Bundle;
import android.view.View;
import android.widget.RadioButton;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.doget.data.R;

public class PayMySelectDialog extends Dialog {
    private Context m_context;
    private OnPayListener onPayListener; 


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));//设置Dialog背景透明
        getWindow().setDimAmount(0f);//设置Dialog窗口后面的透明度

    }

    public PayMySelectDialog(@NonNull Context context, OnPayListener onPayListener) {
        super(context);
        m_context = context;
        this.onPayListener = onPayListener;
        View view = getLayoutInflater().inflate(R.layout.dialog_pay_my_confirm, null);
        setContentView(view);
        initView(view);
    }


//    @OnClick({R.id.ll_zfb_pay, R.id.ll_wx_pay, R.id.tv_ok, R.id.tv_cancel})
//    public void onViewClicked(View view) {
//        switch (view.getId()) {
//            case R.id.ll_wx_pay:
//                setPayClick(2);
//                break;
//            case R.id.ll_zfb_pay:
//                setPayClick(3);
//                break;
//            case R.id.tv_cancel:
//                dismiss();
//                break;
//            case R.id.tv_ok:
//                if (payType == 2) {
//                    onPayListener.onPayClickWX();
//                } else {
//                    onPayListener.onPayClickZFB();
//                }
//                dismiss();
//                break;
//            default:
//                break;
//        }
//    }


    public interface OnPayListener {

        void onSelectOther(String chargeTypeNameList, int isPointPay, int payMethod, int isPrePay);

    }

    private String sfx = "";
    private int zf = -1;
    private int lx = -1;//缴费类型 1预存0清欠
    private int isPointPay = -1;// 1世茂币

    private String defaultlx = "";

    private void initView(View view) {
//         "chargeTypeNameList":"物业服务费|水费",


        TextView btn_confirm = (TextView) view.findViewById(R.id.btn_confirm);
        TextView btn_cancel = (TextView) view.findViewById(R.id.btn_cancel);
        view.findViewById(R.id.close_dialog).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });


        RadioButton sh_1 = (RadioButton) view.findViewById(R.id.sh_1);
        RadioButton sh_2 = (RadioButton) view.findViewById(R.id.sh_2);
        RadioButton sh_3 = (RadioButton) view.findViewById(R.id.sh_3);
        RadioButton sh_4 = (RadioButton) view.findViewById(R.id.sh_4);
        RadioButton sh_5 = (RadioButton) view.findViewById(R.id.sh_5);
        RadioButton sh_6 = (RadioButton) view.findViewById(R.id.sh_6);
//        if (null != resp && null != resp.getValue()) {
//            bean = resp.getValue();
//            if (null != bean.get公区水费() && !bean.get公区水费().equals("")) {
//                sh_1.setText(bean.get公区水费());
//            } else {
//                sh_1.setVisibility(View.INVISIBLE);
//            }
//
//            if (null != bean.get公区电费() && !bean.get公区电费().equals(""))
//                sh_2.setText(bean.get公区电费());
//            if (null != bean.get物业服务费() && !bean.get物业服务费().equals(""))
//                sh_3.setText(bean.get物业服务费());
//            if (null != bean.get能耗费() && !bean.get能耗费().equals(""))
//                sh_4.setText(bean.get能耗费());
//            if (null != bean.get车位服务费() && !bean.get车位服务费().equals(""))
//                sh_5.setText(bean.get车位服务费());
//            if (null != bean.get车位管理费() && !bean.get车位管理费().equals(""))
//                sh_6.setText(bean.get车位管理费());
//        }

        RadioButton lx_1 = (RadioButton) view.findViewById(R.id.lx_1);
        RadioButton lx_2 = (RadioButton) view.findViewById(R.id.lx_2);
        lx_1.setText("清欠");
        lx_2.setText("预存");

        RadioButton zf_1 = (RadioButton) view.findViewById(R.id.zf_1);
        RadioButton zf_2 = (RadioButton) view.findViewById(R.id.zf_2);
        RadioButton zf_3 = (RadioButton) view.findViewById(R.id.zf_3);
        zf_1.setText("微信支付");
        zf_2.setText("支付宝");
        zf_3.setText("世茂币抵扣");

    }
}
